﻿<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>串件单打印</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <link rel="stylesheet" href="/InSiteWebApplication/Content/webuploader/webuploader.css" />
    <style>
        tr,td{border:1px solid;text-align:center;}
        .text_left{text-align:left}
        .borderRight{border-right:none;}
        .borderBottom{border-bottom:none;}
    </style>
</head>
<body>
    <form id="ExchangeInfoForm">
     <div style="text-align: center;padding-top:20px;">
     <div style="width: 900px;display:inline">
        <div style="font-size: 23px;margin-bottom:20px;"><span id="ExchangeType"></span></div>
        <table  cellspacing="0" style="margin: auto">
        <tr style="height:30px">
            <td colspan="4" style="border:none">编号:<span id="ExchangeName" name="ExchangeName"></span></td>
            <td colspan="4" style="border:none">日期:<span id="ExchangeDate"></span></td>
        </tr>
         <tr >
            <td colspan="8" class="text_left borderBottom" style="line-height:40px;padding-left:20px;">
                <input type=checkbox name="ExchangeMethod" value="0" id="ExchangeMethod1"/><label>新机（品）</label>
                <input type=checkbox name="ExchangeMethod" value="1" id="ExchangeMethod0"/><label>修理机（品）</label>
                <!--<div style="width: 160px;float:right;margin-right:200px;">串件类型 
                    <span id="ExchangeType"></span>
                </div>-->
            </td>
         </tr>
        <tr style="height:75px">
            <td style="width:105px;line-height: 20px;" class="borderRight borderBottom">新机（品）/</br>修理机（品）编号</td>
            <td style="" class="borderRight borderBottom"><span  id="ExchangeCodeNo"/></td>
            <td style="width:70px"class="borderRight borderBottom">任务号</td>
            <td style="width:120px" class="borderRight borderBottom"><span   id="ContainerNo"/></td>
            <td style="width:70px;line-height: 20px;" class="borderRight borderBottom" >零组件</br>名称</td>
            <td style="width:120px" class="borderRight borderBottom"><span   id="ProductID" /></td>
            <td style="width:70px;line-height: 20px;" class="borderRight borderBottom">零组件</br>图号</td>
            <td style="width:120px" class=" borderBottom"><span  id="ProductName"/></td>
        </tr>
        <tr>
            <td rowspan="2"  style="width:90px;height:65px;line-height: 20px;" class="borderRight borderBottom">零组件</br>特性</td>
            <td rowspan="2" style="width:100px;" class="borderRight borderBottom">一般件G/Z</td>
            <td rowspan="2" class="borderRight borderBottom" style="line-height: 20px;">零组件</br>批次号</td>
            <td rowspan="2" class="borderRight borderBottom"><span  id="ERPBatchNo"/></td>
            <td class="borderRight borderBottom" style="height:35px;line-height: 20px;">已工作时间/</br>总寿命</td>
            <td class="borderRight borderBottom"><span id="WorkHours"/></td>
            <td rowspan="2" class="borderRight borderBottom">数量</td>
            <td rowspan="2" class=" borderBottom"><span  id="Qty" /></td>
        </tr>
        <tr>
            <td class="borderRight borderBottom" style="height:35px;line-height: 20px;">厂内工作</br>时间</td>
            <td class="borderRight borderBottom"><span id="FactoryWorkHours"/></td>
        </tr>
        <tr >
            <td colspan="8" class="text_left borderBottom" >
                <div style="margin-top:5px">串件原因及处理措施:</div>
                <div style="height:300px;text-indent: 20px;line-height: 20px;"><span id="Reason"/></div>
            </td>
        </tr>
         <tr >
            <td colspan="8" class="borderBottom">
                <div class="text_left"style="margin-top:5px">串件零、组件来源:<div style="height:100px;text-indent: 20px;line-height: 20px;"><span id="Source"/></div></div>
            </td>
        </tr>
         <tr style="height:55px">
            <td class="borderRight borderBottom" style="line-height: 20px;">新机（品）/</br>修理机（品）编号</td>
            <td colspan="3" style="" class="text_left borderRight borderBottom"><span id="UpExchangeCodeNo"/></td>
            <td class="borderRight borderBottom">任务号</td>
            <td class="borderRight borderBottom"><span  id="UpContainerNo"/></td>
            <td class="borderRight borderBottom">数量</td>
            <td class=" borderBottom"><span  id="UpQty"/></td>
        </tr>
        <tr>
            <td  class="borderRight borderBottom" style="width:90px;height:50px" >零组件批次号</td>
            <td  class="borderRight borderBottom"style="width:100px;"><span  id="UpBatchNo"/></td>
            <td class="borderRight borderBottom" style="line-height: 20px;">累计工作时</br>间/总寿命</td>
            <td class="borderRight borderBottom"><span id="TotalWorkHours"/></td>
            <td class="borderRight borderBottom" style="line-height: 20px;">厂内工</br>作时间</td>
            <td colspan="3" class=" borderBottom">
                <div>是否大于被串件厂内工作时间</div>
                    <input type=checkbox name="IsOverFactoryTime" value="1" id="IsOverFactoryTime1"/><label>是</label>
                    <input type=checkbox name="IsOverFactoryTime" value="0" id="IsOverFactoryTime0"/><label>否</label>
            </td>
        </tr>
        <tr style="height:50px">
            <td colspan="4" class="text_left borderBottom borderRight">申请串件分厂（事业单位）：<span  id="factory"/></td>
            <td colspan="4" class="text_left borderBottom">设计部门：<span  id="design"/></td>
        </tr>
         <tr style="height:50px">
            <td colspan="4" class="text_left borderBottom borderRight">工程技术部：<span  id="gcjsb"/></td>
            <td colspan="4" class="text_left borderBottom">生产指挥部：<span  id="sczhb"/></td>
        </tr>
         <tr style="height:50px">
            <td colspan="4" class="text_left borderRight">检验检测事业部： <span  id="jyjcsyb"/></td>
            <td colspan="4" class="text_left">顾客代表：<span  id="CustomerName"/></td>
        </tr>
     </table> 
     </div></div>
     </form>
     <!--信息提示区域-->
    <div id="statusMessage" style="font-size: 14px; height: 40px"></div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/array.pollyfill.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script>
    //创建人：longb
    //日期：2023-05-16
    //描述：创建串件单
    var page = {
        ajaxUrl: getRootPath() + "/Ashx/ZSHandler/ZSExchangeInfoCreateHandler.ashx",
        para: { ExchangeID: getParam("ExchangeID") },
        init: function () {
            page.initPageData('');
            page.bind();
        },
        initPageData: function (type) {
            page.post({ action: 'InitData', ExchangeID: page.para.ExchangeID }, false, function (res) {
                if (res.Result) {
                    $('#ExchangeName').html(res.ReturnData[0].EXCHANGENAME);
                    var data = res.ReturnData[0];
                    $('#ExchangeDate').html(data.CREATEDATE);
                    $('#ExchangeType').html(data.EXCHANGETYPE == "0" ? "零件串件单" : "设计定型（技术鉴定）前零件串件单");

                    $('#ExchangeCodeNo').html(data.EXCHANGECODENO);
                    $('#ContainerNo').html(data.CONTAINERNO);
                    $('#ProductID').html(data.DESCRIPTION);
                    $('#ProductName').html(data.PRODUCTNAME);
                    $('#ERPBatchNo').html(data.ERPBATCHNO);

                    $('#FactoryWorkHours').html(data.FACTORYWORKHOURS);
                    $('#WorkHours').html(data.WORKHOURS);
                    $('#Qty').html(data.QTY);
                    $('#Reason').html(data.REASON);
                    $('#Source').html(data.BILLSOURCE);
                    $('#UpExchangeCodeNo').html(data.UPEXCHANGECODENO);
                    $('#UpContainerNo').html(data.UPCONTAINERNO);
                    $('#UpQty').html(data.UPQTY);
                    $('#UpBatchNo').html(data.UPBATCHNO);
                    $('#TotalWorkHours').html(data.TOTALWORKHOURS);

                    $('#factory').html(data.FINNAME);
                    $('#design').html(data.DESIGNNAME);
                    $('#gcjsb').html(data.GCJSBNAME);
                    $('#sczhb').html(data.SCZHBNAME);
                    $('#jyjcsyb').html(data.JYJCSYBNAME);
                    $('#CustomerName').html(data.CUSTOMERNAME);
                    document.getElementById('ExchangeMethod' + data.EXCHANGEMETHOD).setAttribute('checked', 'checked')
                    document.getElementById('IsOverFactoryTime' + data.ISOVERFACTORYTIME).setAttribute('checked', 'checked')
                    //var formData = { ExchangeMethod: data.EXCHANGEMETHOD, IsOverFactoryTime: data.ISOVERFACTORYTIME }
                    //$('#IsOverFactoryTime' + data.ISOVERFACTORYTIME).setAttribute('checked', 'checked');
                   
                    //$('#ExchangeInfoForm').form('load', formData);
                }
            });
        },
        //页面事件绑定
        bind: function () {
            var data = [{ code: '01', name: 'text' }, { code: '02', name: 'text2'}];
            //page.initCombogridData('productContainer','tb',data);
            //page.initCombogridData('productContainer1', 'tb1', data);
            //page.initCombogridData('productContainer2', 'tb2', data);

            //page.InitBigSmallData(null);
        },
        InitBigSmallData: function (name) {
            page.post({ action: 'GetBigSmallData', data: JSON.stringify(page.para), name: name }, false, function (res) {
                if (name == null) {
                    page.initCombogridData('productContainer', 'tb', res.DBTable);
                } else {
                    $('#productContainer').combogrid('grid').datagrid('loadData', res.DBTable);
                }
            });
        },


        initCombogridData: function (id, tid, data) {
            var columns = [];
            if (id == "productContainer") {
                columns = [{ field: 'PRODUCTID', title: 'PRODUCTID', width: 60, hidden: true },
                    { field: 'PRODUCTNAME', title: '零组件图号', width: 80 },
                    { field: 'PRODUCTDESC', title: '零组件名称', width: 80 },
                    { field: 'PRODUCTBATCHNO', title: 'ERP批次号', width: 70}];
            }
            $('#' + id).combogrid({
                panelWidth: 235,
                panelHeight: 200,
                idField: 'PRODUCTID',
                textField: 'PRODUCTDESC',
                toolbar: '#' + tid,
                data: data,
                columns: [columns],
                onSelect: function (index, row) {
                    if (id == "productContainer") {
                        $('#ProductName').textbox('setValue', row.PRODUCTNAME);
                        $('#ERPBatchNo').textbox('setValue', row.PRODUCTBATCHNO);
                    }
                }
            });
        },

        //保存 ExchangeInfoForm
        submitData: function () {
            var frdata = $('#ExchangeInfoForm').serializeArray();
            var data = {};
            $.each(frdata, function () {
                data[this.name] = this.value
            });
            data.Source = $('#productContainer1').combobox('getText');
            data.UpExchangeCodeNo = $('#productContainer2').combobox('getText');
            var param = {
                action: "SaveExchangeData",
                data: JSON.stringify(data),
                para: JSON.stringify(page.para)
            };
            page.post(param, true, function (res) {
                if (res.Result) {
                    page.para.ExchangeID = res.ReturnData;
                }

                displayMessage(res.Message, res.Result);

            });
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult) {
            clearMessage();
        },
        //post数据
        post: function (param, async, callback) {
            $.ajax({
                type: "Post",
                url: page.ajaxUrl,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        }
    }
    $(function () {
        page.init();
    });



</script>
